package com.fits.auth.api.constants;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.List;

@Getter
@AllArgsConstructor
public enum ClientEnums {
    //客戶端
    FITS_BACKGROUND_USER("fits_back", 3600 * 12, 3600 * 12 * 7, Arrays.asList("password", "refresh_token")),
    FITS_USER("fits", 3600 * 12, 3600 * 12 * 7, Arrays.asList("password", "refresh_token"));

    private final String clientId;
    private final int expired;
    private final int refresh;
    private final List<String> grantType;

    public static ClientEnums findByClientId(String clientId) {
        for (ClientEnums i : ClientEnums.values()) {
            if (i.getClientId().equals(clientId)) {
                return i;
            }
        }
        throw new RuntimeException("未找到客户端信息");
    }
}
